<?php

/**
 * This is the model class for table "jumlahpeternakayamdaging".
 *
 * The followings are the available columns in table 'jumlahpeternakayamdaging':
 * @property integer $jpad_id
 * @property integer $jpad_kec
 * @property integer $jpad_peternak
 * @property integer $jpad_ayam_kurang
 * @property integer $jpad_ayam_lebih
 * @property integer $jpad_ayam_jumlah
 * @property integer $jpad_produksi
 * @property integer $jpad_tahun
 *
 * The followings are the available model relations:
 * @property Kecamatan $jpadKec
 */
class Jumlahpeternakayamdaging extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return Jumlahpeternakayamdaging the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'jumlahpeternakayamdaging';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('jpad_kec, jpad_peternak, jpad_ayam_kurang, jpad_ayam_lebih, jpad_ayam_jumlah, jpad_produksi, jpad_tahun', 'numerical', 'integerOnly'=>true),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('jpad_id, jpad_kec, jpad_peternak, jpad_ayam_kurang, jpad_ayam_lebih, jpad_ayam_jumlah, jpad_produksi, jpad_tahun', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'jpadKec' => array(self::BELONGS_TO, 'Kecamatan', 'jpad_kec'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'jpad_id' => 'Jpad',
			'jpad_kec' => 'Jpad Kec',
			'jpad_peternak' => 'Jpad Peternak',
			'jpad_ayam_kurang' => 'Jpad Ayam Kurang',
			'jpad_ayam_lebih' => 'Jpad Ayam Lebih',
			'jpad_ayam_jumlah' => 'Jpad Ayam Jumlah',
			'jpad_produksi' => 'Jpad Produksi',
			'jpad_tahun' => 'Jpad Tahun',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('jpad_id',$this->jpad_id);
		$criteria->compare('jpad_kec',$this->jpad_kec);
		$criteria->compare('jpad_peternak',$this->jpad_peternak);
		$criteria->compare('jpad_ayam_kurang',$this->jpad_ayam_kurang);
		$criteria->compare('jpad_ayam_lebih',$this->jpad_ayam_lebih);
		$criteria->compare('jpad_ayam_jumlah',$this->jpad_ayam_jumlah);
		$criteria->compare('jpad_produksi',$this->jpad_produksi);
		$criteria->compare('jpad_tahun',$this->jpad_tahun);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}